package co.infinum.goldfinger.example;

/**
 * ex.
 *
 * @author zh
 * @since 2021-06-25
 */
public class MockLoginService {
    /**
     * 初始化
     */
    public MockLoginService() {
    }

    /**
     * Mock real login where you would send PIN, they would do voodoo magic, return
     * whether its true or false.
     *
     * @param pin
     * @param callback
     */
    public void login(String pin, Callback callback) {
        String realPin = SharedPrefs.getPin();
        if (pin.equals(realPin)) {
            callback.onSuccess();
        } else {
            callback.onFailure();
        }
    }

    /**
     * 回调
     */
    interface Callback {
        /**
         * 成功
         */
        void onSuccess();

        /**
         * 失败
         */
        void onFailure();
    }
}
